﻿@model IEnumerable<BusinessLayer.WorldArtPrice.Entities.AdminLogAction>
@{
    ViewBag.Title = "Log Details";
}

<h2>
        Log Details</h2>
    <p>
        @if (ViewData["ErrorMessage"] != null)
           {
        @Html.Label(ViewData["ErrorMessage"].ToString())
        }
    </p>
    <table id="rounded-corner"><thead>
        <tr>
             @*<th>
                <input id="chkAll" onclick="javascript:SelectAll(this);" type="checkbox" />
            </th>*@
            <th class="rounded-company" scope="col">
                UserName
            </th>
            <th class="rounded" scope="col">
                IPAddress
            </th>
            <th class="rounded" scope="col">
                Time
            </th>
            <th class="rounded" scope="col">
                Action
            </th>
            <th class="rounded-q4" scope="col">
                Description
            </th>
        </tr>
        @foreach (var item in Model)
           { 
        <tr>
           @* <td>
                @ Html.CheckBox("check", new { itemid = item.SubscriptionID, refer = "chk", onclick = "javascript:SelectOne(this)" })
            </td>*@
            <td>
                @item.UserName 
            </td>
            <td>
                @item.IPAddress 
            </td>
            <td>
                @item.Time 
            </td>
            <td>
                @item.Action 
            </td>
            <td>
                @item.Description 
            </td>
        </tr>
        }</thead> 
    </table>
    <input id="hidSubscriptionIDs" type="hidden" />
    <script type="text/javascript">
        /*Check, Check All*/
        function SelectAll(spanChk) {

            var hidSelected = $("input[id='hidSubscriptionIDs']");
            var chkList = $("input[refer='chk']");
            var str = "";

            for (var i = 0; i < chkList.length; i++) {
                var chk = chkList[i];
                chk.checked = spanChk.checked;
                if (chk.checked) {
                    str = str + $(chk).attr("itemid") + "_";
                }
            }
            str = str == "" ? "" : str.substring(0, str.length - 1);
            hidSelected.attr("value", str);
            //alert(hidSelected.val());
        }
        function SelectOne() {
            var hidSelected = $("input[id='hidSubscriptionIDs']");
            var chkList = $("input[refer='chk']");
            var str = "";

            for (var i = 0; i < chkList.length; i++) {
                var chk = chkList[i];
                if (chk.checked) {
                    str = str + $(chk).attr("itemid") + "_";
                }
            }
            str = str == "" ? "" : str.substring(0, str.length - 1);
            hidSelected.attr("value", str);
        }
        
            
        
    </script>